import logo from './logo.svg';
import './App.css';
import React, { useEffect, useState } from 'react';

function App(){

  const [count,setCount]=useState(0)
  const [ name , setName]=useState('张三')

  useEffect(()=>{
    console.log('name发生变化了');
  },[])

  useEffect(()=>{
    console.log('count发生变化了');
  })

  function click1(){
    setCount(count+1)
  }
 function click2(){
    setName('李四')
  }
   return (
    <div>
      <div>{count}</div>
      <button onClick={click1}>加一</button>
      <div>{name}</div>
      <button onClick={click2}>修改名字</button>
    </div>
   )
}

export default App;
